﻿<!--#include file="../Include/Config.asp"-->
<link rel="stylesheet" href="../Css/Admin.css" type="text/css" />
<table width="585" border="0" cellspacing="0" cellpadding="0" class="table">
  <tr>
    <th colspan="2">此问卷下已有的题目</th>
  </tr>
<%dim i
Survey_id=request.QueryString("Survey_id")
action=request.QueryString("action")
page_size=10
sql="select * from survey where Survey_id="&Survey_id&""
rs.open sql,conn,1,3
if rs.eof then
call ShowAlert("参数错误","") 
end if
Survey_name=rs("Survey_name")
response.Write("<title>"&siteName&"---"&Survey_name&"-题目管理</title>")
if rs("Survey_content")<>"" then
Survey_content=split(rs("Survey_content"),",")
if (ubound(Survey_content)+1)\page_size<>(ubound(Survey_content)+1)/page_size then'计算出页数
page_count=((ubound(Survey_content)+1)\page_size)+1
else
page_count=(ubound(Survey_content)+1)\page_size
end if
select case action
  case "next"
  if session("page_start")+page_size<=ubound(Survey_content) then'解决多次刷新‘下一页’出现显示异常的原因
  session("page_start")=session("page_start")+page_size
  end if
  case "last"
  session("page_start")=session("page_start")-page_size
  case "end"
  session("page_start")=(page_count-1)*page_size
  case "","start"
  session("page_start")=0
end select
if session("page_start")<0 then
session("page_start")=0
end if
if session("page_start")>=ubound(Survey_content) then
session("page_start")=ubound(Survey_content)
end if
page_start=session("page_start")
page_end=page_start+page_size-1
if page_end>ubound(Survey_content) then
page_end=ubound(Survey_content)
end if
for i=page_start to page_end
if not Survey_content(i)="" then
sql="select * from question where Question_id="&Survey_content(i)&""
rst.open sql,conn,1,1
if not rst.eof then
%>    
  <tr>
    <td><li style="list-style:none"><%=i+1%>、<a href="#" onClick="showModalDialog('QuestionShow.asp?Survey_id=<%=Survey_id%>&Question_id=<%=rst("Question_id")%>',window,'dialogHeight:350px;dialogWidth:360px;dialogleft:220px;help:no;status:no;scroll:no');"><%=rst("Question_content")%></a></li></td>
	<td align="right">
	<%
	if rs("Survey_isAuditing")="0" then
	%>
	<a href="QuestionEdit.asp?Survey_id=<%=Survey_id%>&Question_id=<%=rst("Question_id")%>">编辑</a>&nbsp;
    <a href="QuestionAddImg.asp?Survey_id=<%=Survey_id%>&Question_id=<%=Survey_content(i)%>&i=<%=i%>">添加图片</a>&nbsp;
    <a href="QuestionJd.asp?Survey_id=<%=Survey_id%>&Question_id=<%=Survey_content(i)%>&i=<%=i%>">设置截断</a>&nbsp;
    <a href="QuestionTz.asp?Survey_id=<%=Survey_id%>&Question_id=<%=Survey_content(i)%>&i=<%=i%>">设置跳转</a>&nbsp;
    <a href="QuestionDel.asp?Survey_id=<%=Survey_id%>&Question_id=<%=Survey_content(i)%>&i=<%=i%>">删除</a>
	<%
	else
	response.Write("&nbsp;")
	end if
	%></td>
  </tr>
<%
else
%>
  <tr>
    <td><li style="list-style:none"><%=i+1%>、题目在题库中已经被删除！请删除</li></td>
	<td align="right"><a href="QuestionDel.asp?Survey_id=<%=Survey_id%>&Question_id=<%=Survey_content(i)%>&i=<%=i%>">删除</a></td>
  </tr>
<%
end if
rst.close
end if
next
%>  <tr>
    <td colspan="2">
	<div id="bottom_pagebox" style="padding-right:25px;">
当前第<%=(session("page_start")/page_size)+1%>页
  <%if session("page_start")=0 then%>首页
  <%else%><a href="QuestionList.asp?Survey_id=<%=Survey_id%>&action=start">首页</a>
  <%end if%>
  <%if (session("page_start")-page_size)>=0 then%>
  <a href="QuestionList.asp?Survey_id=<%=Survey_id%>&action=last">上一页</a>
  <%else%>上一页
  <%end if%>				
  <%if (session("page_start")+page_size)<=ubound(Survey_content) then%> 
  <a href="QuestionList.asp?Survey_id=<%=Survey_id%>&action=next">下一页</a>
  <%else%>下一页
  <%end if%>				
  <%if (session("page_start")+page_size)<=ubound(Survey_content) then%>
  <a href="QuestionList.asp?Survey_id=<%=Survey_id%>&action=end">尾页</a>
  <%else%>
  尾页
  <%end if%>
  共<%=page_count%>页/<%=ubound(Survey_content)+1%>个题目&nbsp;每页<%=page_size%>个</div>  </td>
  </tr>
<tr>
  <td colspan="2">注：已经通过审核的问卷，题目将不可编辑和删除</td>
</tr>
<%
else
response.Write("<td colspan=""2"">本问卷下暂时没有任何题目，请&nbsp;&nbsp;<a href=""QuestionAdd.asp?Survey_id="&Survey_id&""">添加</td>")
end if
rs.close
%>
</table>

